home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / strings2.zip / SAVEDI.BAT < prev    next >
DOS Batch File  |  1992-11-05  |  864b  |  43 lines

  1. @ECHO off
  2. REM ===================================================================
  3. REM
  4. REM Use strings to save the current disk and directory.
  5. REM
  6. REM ===================================================================
  7.  
  8.  
  9. REM
  10. REM Pipe the current drive and directory into a env var using the ASK
  11. REM command.
  12. REM
  13.  
  14. CD | STRINGS olddir = ask > NUL
  15.  
  16. REM
  17. REM Change to the root directory of the C: drive to leave where we were.
  18. REM
  19.  
  20. C:
  21. CD \
  22. ECHO on
  23. DIR autoexec.bat
  24. @ECHO off
  25.  
  26. REM
  27. REM Use the LEFT command to separate the drive letter from the directory
  28. REM string, then change to the proper disk.
  29. REM
  30.  
  31. STRINGS drive = LEFT %OLDDIR%, 2
  32. %DRIVE%
  33.  
  34. REM
  35. REM Use the MID command to return the directory string without the drive
  36. REM letter. Change to the proper directory using the CD command.
  37. REM
  38.  
  39. CD %OLDDIR%
  40.  
  41. SET drive=
  42. SET olddir=
  43.